﻿using DevExpress.XtraReports.UI;
using System.Collections.Generic;
using DataAccess;

namespace QuanLyKhachSan
{
    public partial class XrptKhachHang : DevExpress.XtraReports.UI.XtraReport
    {
        KhachHangManager controller = new KhachHangManager();
        public XrptKhachHang()
        {
            InitializeComponent();
            NewMethod();
        }

        private void NewMethod()
        {
            List<KhachHang> list = controller.LayDanhSach().Result;
            foreach (var kh in list){
                XRTableCell cell1 = new XRTableCell();
                XRTableCell cell2 = new XRTableCell();
                XRTableCell cell3 = new XRTableCell();
                XRTableCell cell4 = new XRTableCell();
                XRTableCell cell5 = new XRTableCell();
                XRTableCell cell6 = new XRTableCell();
                XRTableCell cell7 = new XRTableCell();

                cell1.WidthF = 85;
                cell2.WidthF = 150;
                cell3.WidthF = 80;
                cell4.WidthF = 65;
                cell5.WidthF = 150;
                cell6.WidthF = 90;
                cell7.WidthF = 80;

                cell1.Text = kh.MaKH;
                cell2.Text = kh.HoTenKH;
                cell3.Text = kh.QuocTich.TenQT;
                cell4.Text = kh.GioiTinh?"Nam":"Nữ";
                cell5.Text = kh.NgheNghiep;
                cell6.Text = kh.SDT;
                cell7.Text = kh.NgaySinh.ToShortDateString();

                XRTableRow row1 = new XRTableRow();
                row1.Cells.Add(cell1);
                row1.Cells.Add(cell2);
                row1.Cells.Add(cell3);
                row1.Cells.Add(cell4);
                row1.Cells.Add(cell5);
                row1.Cells.Add(cell6);
                row1.Cells.Add(cell7);
                xrTable2.Rows.Add(row1);
            }
            xrTable2.Rows[0].Visible = false;
        }
    }
}
